package lanqiao;

import java.util.Scanner;

public class E {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n+1];
        for (int i=1;i<=n;i++) {
            x[i] = sc.nextInt();
        }
        int[][] aB = new int[n+1][2];
        for (int i=1;i<n;i++) {
            aB[i][0] = sc.nextInt();
            aB[i][1] = sc.nextInt();
        }
        double[][] dp = new double[n+1][2];
        //[][0]表示到达第i根杆底，[1]表示到达门
        dp[1][0] = x[1];
        dp[1][1] = x[1]+aB[1][0]/0.7;
        System.out.println(dp[1][0]+" "+dp[1][1]);
        for (int i=2;i<n;i++) {
            double diToDi = x[i]-x[i-1]+dp[i-1][0];
            double diToMen = x[i]-x[i-1]+dp[i-1][0]+aB[i][0]/0.7;
//            double menTodi = dp[i-1][1]+aB[i-1][1]/1.3+x[i]-x[i-1];
            double menToMen = dp[i-1][1]+(aB[i-1][1]>aB[i][0] ? (aB[i-1][1]-aB[i][0])/1.3 : (aB[i][0]-aB[i-1][1])/0.7);
            double menToDi = dp[i-1][1]+aB[i-1][1]/1.3;
            System.out.println("ditodi="+diToDi+
                    " diTomen="+diToMen+" MenTodi="+menToDi+" Mentomen="+menToMen);
            dp[i][0] = Math.min(diToDi,menToDi);
            dp[i][1] = Math.min(menToMen,diToMen);
        }
        double diToDi = x[n]-x[n-1]+dp[n-1][0];
        double menTodi = dp[n-1][1]+aB[n-1][1]/1.3+x[n]-x[n-1];
        System.out.println(Math.min(diToDi,menTodi));
    }
}
